var checkbox1_id;
var checkbox2_id;
var checkbox3_id;
var checkbox4_id;
var how_many_id;
var how_many_op_id;

function init (checkbox1, checkbox2, checkbox3, checkbox4, hm, hmop)
{
	checkbox1_id = checkbox1;
	checkbox2_id = checkbox2;
	checkbox3_id = checkbox3;
	checkbox4_id = checkbox4;
	how_many_id = hm;
	how_many_op_id = hmop;
	
	document.getElementById(checkbox1_id).disabled = false;
	document.getElementById(checkbox2_id).disabled = false;
	document.getElementById(checkbox3_id).disabled = false;
	document.getElementById(checkbox4_id).disabled = false;
}

function enablePart (checkbox_id, elem1_id, elem2_id)
{
	var checked = document.getElementById(checkbox_id).checked ? true : false;
	
	document.getElementById(elem1_id).disabled = checked ? false : true;
	document.getElementById(elem2_id).disabled = checked ? false : true;
	
	enableHowMany();
}		

function enableHowMany ()
{
	var any_enabled = 
		document.getElementById(checkbox1_id).checked ||
		document.getElementById(checkbox2_id).checked ||
		document.getElementById(checkbox3_id).checked ||
		document.getElementById(checkbox4_id).checked
		? true : false;
		
	document.getElementById(how_many_id).disabled =
		any_enabled ? false : true;
		
	document.getElementById(how_many_op_id).disabled =
		any_enabled ? false : true;
}
